package com.xdf.zipperdye.service;

import com.xdf.zipperdye.dao.business.SysRolepMapper;
import com.xdf.zipperdye.model.SysRolep;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SysRolepServiceImpl implements SysRolepService {

    @Autowired
    private SysRolepMapper dao;

    @Override
    public int deleteByPrimaryKey(Integer iid) {
        return dao.deleteByPrimaryKey(iid);
    }

    @Override
    public SysRolep insert(SysRolep record) {
        int ret = dao.insert(record);
        return selectByPrimaryKey(record.getIid());
    }

    @Override
    public SysRolep insertSelective(SysRolep record) {
        int ret = dao.insertSelective(record);
        return selectByPrimaryKey(record.getIid());
    }

    @Override
    public SysRolep selectByPrimaryKey(Integer iid) {
        return dao.selectByPrimaryKey(iid);
    }

    @Override
    public SysRolep updateByPrimaryKeySelective(SysRolep record) {
        int ret = dao.updateByPrimaryKeySelective(record);
        return selectByPrimaryKey(record.getIid());
    }

    @Override
    public SysRolep updateByPrimaryKey(SysRolep record) {
        System.out.println("传入修改方法的参数是：" + record.toString());
        int tmp = dao.updateByPrimaryKey(record);
        SysRolep ret = selectByPrimaryKey(record.getIid());
        System.out.println("修改后的对象是：" + ret);
        return ret;
    }

    @Override
    public List<SysRolep> selectAll() {
        return dao.selectAll();
    }

    @Override
    public List<SysRolep> selectByRoleIid(int role_iid) {
        return dao.selectByRoleIid(role_iid);
    }

}